#!/bin/bash
rm -fr build dist *.deb
rm -fr ~/Desktop/lance*.deb
rm -fr ~/Desktop/scripts*.zip
pyinstaller -y --clean -D main.py -n lance --ico=UI/icos/lance.png --hidden-import=pynput.keyboard._xorg --hidden-import=pynput.mouse._xorg #--add-binary='/home/lz/miniconda3/envs/lance/lib/python3.9/site-packages/cv2/qt/plugins/platforms/libqxcb.so:libqxcb.so'
lance_path=$(pwd)"/deb/opt/lance"

if [ -d "$lance_path" ]; then
    echo $lance_path
else
    mkdir -p  "$lance_path"
fi

cp -r dist/lance deb/opt/
cp -r deb/share/ deb/opt/lance/
sudo dpkg -b deb lance5.4.0_amd64.deb
sudo dpkg -i lance5.4.0_amd64.deb
cp lance*.deb ~/Desktop
rm -fr *.deb
rm -fr build dist
cd source/scripts
./py2so.sh